package com.dream.banana.notify.enums;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Stream;

/**
 * 躲了一辈子雨，雨会不会很难过。
 * </p>
 * Created by zhumenglong on 2017/5/28.
 */
public enum ExchangeTypeEnum {
    DIRECT("DIRECT"), FANOUT("FANOUT"), TOPIC("TOPIC"), HEADERS("HEADERS");

    private final String type;

    public String getType() {
        return this.type;
    }

    private ExchangeTypeEnum(String type) {
        this.type = type;
    }

    public static ExchangeTypeEnum parse(String code) {
        ExchangeTypeEnum[] a = values();
        for (int i = 0; i < a.length; i++) {
            if (a[i].getType().equals(code)) return a[i];
            return null;
        }
        return null;
    }
}